from dataclasses import dataclass
from pathlib import Path
import os
@dataclass
class VoiceConversionTask:
    task: str
    base_dir: Path = Path('/root/autodl-tmp/Retrieval-based-Voice-Conversion-WebUI')

    @property
    def model_path(self) -> Path:
        return self.base_dir / 'weights' / f'{self.task}.pth'

    @property
    def index_file_path(self) -> Path:
        return self.base_dir / 'logs' / self.task / f'added_IVF929_Flat_nprobe_1_{self.task}_v2.index'
from datetime  import datetime
# 示例使用
task_name = 'example_task'
task = VoiceConversionTask(task=task_name)
print(f'Model path: {task.model_path}')
print(f'Index file path: {task.index_file_path}')
@dataclass
class GenerationConfig:
    job :str
    userid :str
    timestamp :str
    raw_vocal_file :str = ''
    raw_instrument_file :str = ''
    @classmethod
    def get_ts(cls):
        timestamp = datetime.now().strftime('%Y%m%d%H%M%S')
        return str(timestamp)
    @property
    def job_id(self):
        #timestamp = datetime.now().strftime('%Y%m%d%H%M%S')
        return  f'{self.job}_{self.userid}_{self.timestamp}'
    @property
    def song_gen_path(self):
        return os.path.join(self.job_id,'output.wav')

    @property
    def vocal_ai_gen_path(self):
        return os.path.join(self.job_id,'vocal.wav')


    def make_folder(self):
        os.makedirs(self.job_id, exist_ok=True)
@dataclass
class AudioSplitPaths:
    file_name_without_extension: str
    base_dir: str = '/root/autodl-tmp/Retrieval-based-Voice-Conversion-WebUI/split_'

    @property
    def save_root_vocal(self) -> Path:
        return Path(self.base_dir + self.file_name_without_extension + '/vocal')

    @property
    def save_root_ins(self) -> Path:
        return Path(self.base_dir + self.file_name_without_extension + '/inst')

    def make_folder(self):
        os.makedirs(self.save_root_vocal, exist_ok=True)
        os.makedirs(self.save_root_vocal, exist_ok=True)

# 示例使用
